package cn.pzhu.java.ch02.statements;

public class IFDemo {

	public static void main(String[] args) {
		int i=100;
		if(i<100){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		if(i==100){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		if(100==i){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		
		boolean f=false;
		//if(f==true){
		if(f=true){
		//if(true=f){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		
		if(foo()){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		
		if(getStudentCount()<30){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		
		System.out.println("======1======");
		if(foo()&&goo()){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		System.out.println("======1.5======");
		if(goo()&&foo()){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		System.out.println("======2======");
		if(foo()&goo()){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		System.out.println("======3======");
		if(goo()||foo()){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		System.out.println("======4======");
		if(goo()|foo()){
			System.out.println("IF OK");
		}else{
			System.out.println("ELSE OK");
		}
		

	}
	
	static int getStudentCount(){
		System.out.println("getStudentCount call");
		return 100;
	}
	static boolean foo(){
		System.out.println("foo call");
		return false;
	}
	static boolean goo(){
		System.out.println("goo call");
		return true;
	}

}
